<?php


$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
mysql_select_db("elihan", $connection);
mysql_query("set names 'utf8'");
$selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$company'  and am.`Status` = 2");
$result = mysql_fetch_assoc($selectdatabase);


mysql_close($connection);

$database = $result[DatabaseName];
//echo $database;
	try {
		ini_set('display_errors', 0);
		$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
		if(!$connection){		
			session_destroy();	
			include 'backlogin.php';	
		}		
		if(!mysql_select_db($database,$connection)){	
			echo $database;	
			session_destroy();	
			include 'backlogin.php';	
		}
		if(!mysql_query("SET CHARACTER SET 'utf8'", $connection)){		
			session_destroy();	
			include 'backlogin.php';	
		}
	} catch (Exception $e) {
		session_destroy();
		include 'backlogin.php';	
		
	}
		
?>